import{ay as h}from"./CtbHscGXagutd.js";function e(s,t){return s*t/100}function o(s,t){return s*t/(100+t)}function a(s,t){return s-o(s,t)}function l(s,t){return 100*s/t}function u(s,t){return s+e(s,t)}class x{net=0;gross=0;tax=0;value=0;taxRate=0;weight=0;normalize;constructor(t,r=2){this.value=t,this.normalize=n=>h(n,r)}equals(t){return this.net===t.net&&this.gross===t.gross&&this.tax===t.tax}testAgainstValues(t,r){const n=this.grossForTax(r);if(t.includes(n)&&(this.gross=n,this.net=this.value),!this.gross){const i=this.netForTax(r);t.includes(i)&&(this.gross=this.value,this.net=i)}if(!this.gross){const i=this.grossTaxAmountForTax(r);t.includes(i)&&(this.gross=this.value+i,this.net=this.value)}if(!this.gross){const i=this.netTaxAmountForTax(r);t.includes(i)&&(this.gross=this.value,this.net=this.value-i)}return this.gross&&this.gross>0&&t.includes(this.gross)?(this.tax=this.normalize(this.gross-this.net),this.taxRate=r,t.includes(this.net)&&(this.weight+=1),t.includes(this.tax)&&(this.weight+=1.1),!0):!1}toString(){return`${this.net} + ${this.tax} = ${this.gross} (${this.taxRate}%) [origin=${this.value}]`}grossForTax(t){return this.normalize(u(this.value,t))}netForTax(t){return this.normalize(a(this.value,t))}grossTaxAmountForTax(t){return this.normalize(e(this.value,t))}netTaxAmountForTax(t){return this.normalize(o(this.value,t))}}export{x as T,a,u as g,l as n,o as t};